package com.app.bussinesslocator;

import com.app.bussinesslocator.bean.ObjBussiness;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RatingBar;
import android.widget.TextView;

public class DetailRatingActivity extends Activity implements OnClickListener{
	
	
	Button btnBack;
	ObjBussiness objBussiness = new ObjBussiness();
	TextView txtNameBusiness;
	RatingBar rtOver, rt1, rt2, rt3, rt4;
	TextView title;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_detail_rating);
		
		objBussiness = getIntent().getParcelableExtra("objBusiness");

		btnBack = (Button) findViewById(R.id.btn_back);
		title = (TextView) findViewById(R.id.title);
		title.setText("View Detail");
		
		txtNameBusiness = (TextView) findViewById(R.id.txt_name);
		
		rtOver = (RatingBar) findViewById(R.id.ratingBar);
		rt1 = (RatingBar) findViewById(R.id.ratingBar1);
		rt2 = (RatingBar) findViewById(R.id.ratingBar2);
		rt3 = (RatingBar) findViewById(R.id.ratingBar3);
		rt4 = (RatingBar) findViewById(R.id.ratingBar4);
		
		
		setData();
		init();
	}
	
	void init(){
		
		btnBack.setOnClickListener(this);
		
	}
	
	void setData(){
		txtNameBusiness.setText(objBussiness.getBussinessName());
		rtOver.setRating(objBussiness.getOverall());
		rt1.setRating(objBussiness.getRating1());
		rt2.setRating(objBussiness.getRating2());
		rt3.setRating(objBussiness.getRating3());
		rt4.setRating(objBussiness.getRating4());
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_back:
			finish();
			break;

		default:
			break;
		}
	}

}
